using System.ComponentModel.DataAnnotations;
using FytSoa.Common.Enum;
using SqlSugar;

namespace FytSoa.Domain.Erp;

/// <summary>
/// erp-采购退货
/// </summary>
[SugarTable("erp_purchase_return")]
public class ErpPurchaseReturn:Entity
{
    /// <summary>
    /// 采购退单编号
    /// </summary>
    [Required]
    [StringLength(50)]
    public string Number { get; set; }

    /// <summary>
    /// 供应商编号
    /// </summary>
    [Required]
    public long SupplierId { get; set; }
    
    /// <summary>
    /// 供应商
    /// </summary>
    [Navigate(NavigateType.OneToOne, nameof(SupplierId))]
    public ErpSupplier Supplier { get; set; }

    /// <summary>
    /// 采购订单编号
    /// </summary>
    [Required]
    public long OrderId { get; set; }
    
    /// <summary>
    /// 采购订单信息
    /// </summary>
    [Navigate(NavigateType.OneToOne, nameof(OrderId))]
    public ErpPurchaseOrder Order { get; set; }

    /// <summary>
    /// 退货金额
    /// </summary>
    [Required]
    public decimal Amount { get; set; }

    /// <summary>
    /// 退货日期
    /// </summary>
    [Required]
    public DateTime ReturnTime { get; set; } = DateTime.Now;

    /// <summary>
    /// 状态
    /// </summary>
    public ErpAuditEnum Status { get; set; } = 0;

    /// <summary>
    /// 备注
    /// </summary>
    public string Remark { get; set; }

    /// <summary>
    /// 创建人
    /// </summary>
    public string CreateUser { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    [Required]
    public DateTime CreateTime { get; set; } = DateTime.Now;

    /// <summary>
    /// 更新人
    /// </summary>
    public string UpdateUser { get; set; }

    /// <summary>
    /// 更新时间
    /// </summary>
    public DateTime? UpdateTime { get; set; }


}